package jdbctest2;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

public class JDBCDemo2 {
    public static void main(String[] args) {
        try(Connection connection = DBUtil.getConnection()) {
            Statement statement = connection.createStatement();
            String sql = "INSERT INTO sanguo\n" +
                    "VALUES (1, '曹操', '男', '魏', 256, 63),\n" +
                    "       (2, '张辽', '男', '魏', 328, 69),\n" +
                    "       (3, '甄姬', '女', '魏', 168, 34),\n" +
                    "       (4, '夏侯渊', '男', '魏', 366, 83),\n" +
                    "       (5, '刘备', '男', '蜀', 220, 59),\n" +
                    "       (6, '诸葛亮', '男', '蜀', 170, 54),\n" +
                    "       (7, '赵云', '男', '蜀', 377, 66),\n" +
                    "       (8, '张飞', '男', '蜀', 370, 80),\n" +
                    "       (9, '孙尚香', '女', '蜀', 249, 62),\n" +
                    "       (10, '大乔', '女', '吴', 190, 44),\n" +
                    "       (11, '小乔', '女', '吴', 188, 39),\n" +
                    "       (12, '周瑜', '男', '吴', 303, 60),\n" +
                    "       (13, '吕蒙', '男', '吴', 330, 71)";
            int num = statement.executeUpdate(sql);
            System.out.println(num == 13? "插入成功":"插入失败");
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
